<?php
    class TaskAction extends  AppAction{
        public function _initialize(){
            $this->model=new App_taskModel();
        }
        //获取任务 1000
        public function index(){
            if($_POST['requestType']=='1000'){
                if($_POST['userId']&&$_POST['requestId']&&$_POST['deviceId']){
                    if($this->belong($_POST['requestId'],$_POST['userId'])){//判断从属
                        $map['t.site_id']=__SITEID__;
                        $map['t.member_id']=$_POST['requestId'];
                        if($_POST['category'])$map['t.type_id']=$_POST['category'];//分类
                        if($_POST['status'])$map['t.status']=$_POST['status'];//状态

//                        if($_POST['department'])$map['d.id']=$_POST['department'];//部门
                        if($_POST['operator'])$map['t.reviewer_id']=$_POST['operator'];//负责人

                        if($_POST['dateFrom']&&$_POST['dateTo']){
                            $map['t.time']=array('between',array(strtotime($_POST['dateFrom']),strtotime($_POST['dateTo'])));
                        }elseif($_POST['dateFrom']){
                            $map['t.time']=array('gt',strtotime($_POST['dateFrom']));
                        }elseif($_POST['dateTo']){
                            $map['t.time']=array('lt',strtotime($_POST['dateTo']));
                        }

                        $data=$this->model->task($map);
                        $this->callback($data);
                    }
                }
            }
        }
    }